//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_handledeadvec.sqf"
#include "x_setup.sqf"

private ["_v", "_type", "_dir", "_pos", "_vel", "_dv", "_fuel", "_putsmex"];
PARAMS_1(_v);
_type = typeOf _v;
_dir = direction _v;
_pos = position _v;
_vel = velocity _v;
_fuel = (fuel _v) / 2;
_putsmex = !isNil {GV(_v,GVAR(smvec))};
{deleteVehicle _x} forEach ([_v] + crew _v);
_dv = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
_dv setDir _dir;
_dv setPos _pos;
_dv setVelocity _vel;
_dv setFuel _fuel;
_dv setDamage 1;
_dv setVariable [QGVAR(ddeadt), diag_tickTime];
__addDead(_dv)
if (_putsmex) then {GVAR(x_sm_vec_rem_ar) set [count GVAR(x_sm_vec_rem_ar), _dv]};